package com.mashibing.search.utils;

import com.mashibing.common.model.StandardReport;

import java.time.LocalDateTime;

/**
 * @author SNA
 * @date 2025/10/20
 * @Description 线程本地变量工具类，用于在当前线程中存储和获取StandardReport对象
 **/
public class SearchUtils {

    // 索引前缀
    public static final String INDEX = "sms_submit_log_";

    // 获取当前年份
    public static String getYear() {
        return LocalDateTime.now().getYear() + "";
    }

    // 线程本地变量，用于存储StandardReport对象
    private static ThreadLocal<StandardReport> reportThreadLocal = new ThreadLocal<>();

    public static void set(StandardReport report) {
        reportThreadLocal.set(report);
    }

    public static StandardReport get() {
        return reportThreadLocal.get();
    }

    public static void remove() {
        reportThreadLocal.remove();
    }
}
